<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>JSONP</title>
</head>
<body>

</body>
<script>
   var  xhr = new XMLHttpRequest();
   xhr.open("POST","http://localhost:9090/ajax",true);
   //设置请求投中的内容类型
   //xhr.setRequestHeader("Content-Type","application/json");
   xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded");//text/plain;charset=UTF-8
   xhr.onreadystatechange =function (ev) {
       if(xhr.readyState == 4){
           console.log(xhr.responseText)
       }
   };
   var json ={};
   json['name'] = 'xueyushuai';

   xhr.send(JSON.stringify(json));
</script>
</html>